SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].gspPermission_SEARCH
(
@permissionId int = null,
@accountId int = null,
@accessRoleId int = null,
@createdDate datetime = null,
@lastModifiedDate datetime = null,
@isDeleted nchar(10) = null
)
AS

SELECT
  *
FROM
  [dbo].[Permission]
WHERE
  (@permissionId IS NULL OR [PermissionId] = @permissionId)
AND
  (@accountId IS NULL OR [AccountId] = @accountId)
AND
  (@accessRoleId IS NULL OR [AccessRoleId] = @accessRoleId)
AND
  (@createdDate IS NULL OR [CreatedDate] = @createdDate)
AND
  (@lastModifiedDate IS NULL OR [LastModifiedDate] = @lastModifiedDate)
AND
  (@isDeleted IS NULL OR @isDeleted = '' OR [IsDeleted] LIKE @isDeleted + '%')


GO
